home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-13
/
me_cd22.zip
/
DOC.ZIP
/
ME2MUTT.DOC
< prev
next >
Wrap
Text File
|
1992-04-27
|
59KB
|
1,186 lines
!!!Concepts chapter:
talk about garbage collection: what when
talk general about bags, marks, buffers
talk about current buffer, current window ain't the same
========================================================================
== The ME Mutt Connection Craig Durland 9/89 10/91 11/91 ==
========================================================================
This document describes the link between the Mutt2 programming
langauge (see MUTT2.DOC) and the Mutt Editor II (see ME2.DOC).
Copyright 1991 Craig Durland
Distributed under the terms of the GNU General Public License.
Distributed "as is", without warranties of any kind, but comments,
suggestions and bug reports are welcome.
========================================================================
== The ME2 Mutt functions ==
========================================================================
(append-to-bag bag-id TEXT <text>)
(append-to-bag bag-id REGION [mark1 mark2])
(append-to-bag bag-id CHARACTERS <number>)
(append-to-bag bag-id RECTANGLE [mark1 mark2])
where TEXT = 0, CHARACTERS = 1, REGION = 2 and RECTANGLE = 3.
TEXT : [NUMBER 0 STRING : VOID]
REGION : [NUMBER 1 [NUMBER [NUMBER]] : VOID]
CHARACTERS : [NUMBER 2 NUMBER : VOID]
RECTANGLE : [NUMBER 3 [NUMBER [NUMBER]] : VOID]
These functions append text to a bag.
TEXT : Appends a string to the bag.
REGION : Appends the text contained in a region.
CHARACTERS : Appends n characters, starting from the dot.
RECTANGLE : Copies the region-rectangle. This clears the bag first.
Note that appending anything to a bag with a rectangle in it
(unless it is another rectangle) is a no-op until you clear the
bag.
For example:
If the region contains "This is a test" then
(clear-bag 0)
(append-to-bag 0 REGION) (append-to-bag 0 TEXT " foo bar")
will set the cut buffer to "This is a test foo bar".
See also: create-bag, clear-bag, insert-register, bag-stats,
bag-to-string.
(arg-flag) [zip : BOOLEAN]
Check to see if somebody set the arg-prefix before calling this
routine (via (universal-argument) or (arg-prefix n)).
See also: arg-prefix.
(arg-prefix [arg]) [[NUMBER] : NUMBER]
Get or set the universal-argument.
With an arg, its the same as ^U before a function.
Notes:
The arg-flag is set to TRUE.
This really sets two prefixes: one for ME commands and one for
Mutt programs. ME commands and exe-key use and reset the prefix
to 1. Programs can only read the prefix and so it will stay the
same for all children of a program unless it is changed by
(arg-prefix n). If it is changed, all the children AND parents
will see the new value. It is a good idea to make a copy of the
value upon entry to a program if it is possible that a child
might change it.
If prefix is not set, it is always 1 (and the arg-flag is FALSE)
when a program or ME command is run from the keyboard.
Note that there is a difference between (arg-prefix 1) and the default.
Setting arg-prefix sets arg-flag. There are commands that just look
at arg-flag and do different things if it is set.
For example, to make META-n start the (universal-argument) count at n,
use the following (where n is 1,2,3,4,5,6,7,8 or 9):
(defun
META-arg { (arg-prefix (- (key-pressed) 0x230))(universal-argument) }
MAIN
{
(int j)
(for (j 1)(< j 10)(+= j 1)
(bind-to-key (concat "META-arg")(concat "M-" j)))
}
)
See also: (arg-flag), (universal-argument) in ME2.DOC.
(argc) [zip : NUMBER]
The number of parameters on the command line when ME was invoked +1.
eg "ME2 foo bar" has argc == 3.
Use argv to look at the parameters.
(argv) [NUMBER : STRING]
The ME command line parameters. There are argc of them, numbering
0...argc-1. (argv 0) is the name of the program (ME) (unless you are
running on MS-DOS 2.x where it is ""), (argv 1) is the first file name
(which is loaded by me2.mut), (argv 2) is the next file name, etc.
See nextfile.mut for an example.
(attached-buffer window-id | buffer-name) [NUMBER|STRING : NUMBER]
If given a number, attached-buffer returns the buffer id that is
attached to window n. n == -1 means use the current window.
If given a name, attached-buffer returns the id of the buffer that is
named name. Returns -2 if the buffer does not exist.
For example:
if the cursor is in third window (window #2) which is displaying
buffer "foobar" and foobar has an id of 123 then:
(attached-buffer -1) and (attached-buffer 2) both return 123.
(attached-buffer "foobar") returns 123.
(attached-buffer "FOOBAR") returns -2.
See also: buffers, windows.
(bag-stats bag-id pointer-to-data) [NUMBER BLOB : VOID]
Get stats on a bag. pointer-to-data is a pointer the the data area
that the stats are put into:
(byte type) (small-int width height) (int size) ;; struct BagInfo
type: 0 means text and 1 is rectangle.
width, height: If the register is a rectangle.
size: Number of bytes in the register.
For example:
(defun get-bag-stats
{
(byte type)(small-int width height)(int size) ;; struct BagInfo
(int n)
(n (convert-to 3 (ask "bag id: ")))
(bag-stats n (loc type))
(msg "bag[" n "]: " (if (== type 0) "Text." "Rectangle.")
" Width:" width " Height:" height " Size:" size
)
})
Note:
If the bag is not a rectangle, the width and height are garbage.
See also: append-to-bag, clear-bag, insert-bag.
(bag-to-file bag-id file-name) [NUMBER STRING : BOOLEAN]
Copy the contents of a bag to a file. If the file already exists, it
is overwritten.
If bag-id is bad, the program aborts.
If some kind of error occurs (can't open file-name or can't write all
of bag), FALSE is returned so you can clean up if necessary.
See also: file-to-bag, bag-to-string
(bag-to-string bag-id) [NUMBER : STRING]
Convert bag contents to a string.
If the bag contains a rectangle, the string will be each line of the
rectangle, one after the other.
Note:
The string sticks around until the bag is changed (clear-bag,
append-to-bag, etc). At that point, the string is garbage and can
cause unknown behaivor if used. Use the string or save it - don't
expect it to hang around.
See also: append-to-bag
(bit-and x y [z ...]) [NUMBER NUMBER [NUMBER ...] : NUMBER]
Binary and 2 or more numbers.
See also bit-or, bit-xor.
(bit-or x y [z ...]) [NUMBER NUMBER [NUMBER ...] : NUMBER]
Binary or 2 or more numbers.
See also bit-and, bit-xor.
(bit-xor x y [z ...]) [NUMBER NUMBER [NUMBER ...] : NUMBER]
Binary xor 2 or more numbers.
See also bit-and, bit-or.
(buffer-flags buffer-id [flags]) [NUMBER [NUMBER] : NUMBER]
Get or set the buffer flags. There are 32 flags.
Bit Flag Notes
--- ---- -----
0x0001 Modified 1 if the buffer has been modified since last save.
0x0002 NoCare 1 if don't care about buffer contents.
0x0004 Hidden 1 if buffer is hidden from user.
0x0008 Undo 1 if undo is turned on for the buffer.
0x0010 Mode Tickle bit: force (modeline-hook) to be called.
0x0020 Immortal Not a temporary buffer.
0x0040 Interactive A buffer for humans.
The lower eight bits are reserved for ME2's use, you can use the
other 24. Note - you might want to leave a few bits at the bottom
unused in case I need some more in the future.
Notes:
The Modified flag is set whenever the buffer changes. When it
changes, (modeline-hook) is called.
The NoCare flag is used whenever ME wants exit or change a buffer -
it is set, ME will not ask before changes are made.
A buffer with the Hidden flag set is invisible to the user -
(next-buffer) skips it, the help and command completion routines
ignore it.
If you want a buffer to have undo, set this bit. 0 (off) is the
default.
Mode is a write only flag. Set it if you want (modeline-hook) to be
called.
All buffers are created Mortal by default. This means that they can
be garbage collected when your program is done running. If you
want the buffer to live forever (at least until you free it), set
this bit. Actually, set this bit in (create-buffer).
ME sets the Interactive bit for program convenience. I typically
use it to avoid setting modes, etc for buffers where the modes
won't be used. It is set by: (switch-to-buffer), (visit-file)
and when the last buffer is freed and I have to create *scratch*.
If a tickle bit is set, only tickle bits are processed and other
bits are ignored. So, for example, if you wanted (modeline-hook)
called and set the Undo flag, it takes two calls to
(buffer-flags).
See also: buffer-modified, create-buffer, modeline-hook.
(buffer-modified buffer-id [bool]) [NUMBER [BOOLEAN] : BOOLEAN]
Check to see if buffer n is modified.
If n == -1 the current buffer is used.
(buffer-modified -1) : TRUE if the current buffer is modified.
(buffer-modified 123) : TRUE if the buffer with id 123 has been modified.
(buffer-modified -1 FALSE) : mark the current buffer as not modified.
See also: buffer-flags, current-buffer, (not-modified).
(buffer-name buffer-id) [NUMBER : STRING]
Return the name of a buffer.
(buffer-name -1) returns the name of the current buffer.
See also: create-buffer, current-buffer, file-name.
(buffer-stats n array int 6) [NUMBER BLOB : VOID]
Get some stats on the nth buffer. n == -1 means current buffer.
These stats are: buffer-size (in characters), dot (number of
characters from the start of the buffer), lines (number of text
lines in the buffer), buffer-row (the line in the buffer the dot is
on), wasted (the number of characters allocated but not used) and
character-at-dot (ASCII value - eg if the dot is on a "A" then
character-at-dot == 65).
Note that buffer-size may NOT be the same as the file size. For
example, on MS-DOS the buffer is smaller than the file because the
<carrage-return><newline> is folded into a newline when the file is
read into the buffer.
An example of a typical Emacs buffer stats routine (ie whats bound to
"^X=") is:
(include tobase.mut)
(defun show-buffer-stats ; bind this to "C-X="
{
;; struct BufferInfo
(int buffer-size dot lines buffer-row wasted char-at-dot ratio)
(buffer-stats -1 (loc buffer-size))
(ratio 0)(if (!= 0 buffer-size)(ratio (/ (* 100 dot) buffer-size)))
(msg "Row: " buffer-row "/" lines " Column: " (current-column)
" CH: 0x" (tobase char-at-dot 16)
" (" ratio "% of " buffer-size ")")
})
See also: nth-buffer
(buffer-var var-name [value]) [STRING [val] : val]
Each buffer can have local variables. These vars are not used by ME2 -
they are there for program use.
The current buffer is searched for a buffer variable named var-name.
If it exists and you are trying to set its value, the value is
checked to make sure its type matches that of the buffer var and
then value is copied into the var.
The var is returned (with the new value if set), ready to be used like
any other Mutt var.
For example:
(int n)
(create-buffer-var NUMBER "x") ;; create buffer var x of type number
(create-buffer-var STRING "s" "t") ;; create 2 string buffer vars
(buffer-var "x" 123) ;; set buffer var x to 123
(n (buffer-var "x")) ;; also set n to 123
(buffer-var "s" "foo bar") ;; set buffer var s to "foo bar"
Notes:
Lists and strings are not as well supported in Mutt2 as they could
be. Right now, I don't have list or string pointer variables so
if you want to use a list or string buffer variable without
refering to it by name, you have to do extra data copies. For
example, if you have a list buffer variable and want to modify it,
you can either use (buffer-var "foo") everytime you need the list
(and spend time doing lookups) or you can (list foo)(foo
(buffer-var "foo")) and then use foo as you would any other list.
The drawback here is a copy of the buffer var is put into foo
(possibly wasting space if the buffer var is very big and it takes
time to do the copy). You also have to remember to copy foo back
into the buffer bar after you modify it or all your changes will
be garbage collected into never-never land. If I ever get around
to implementing pointer types, you will be able to (pointer list
foo)(foo (loc (buffer-var "foo"))) and then when you modify foo,
you will be really modifing the buffer var, avoiding extraneous
data copies and making less garbage to be collected. You can fake
pointers by passing the buffer var to a function: (bar
(buffer-var "foo")) where (defun bar (list foo) ...). bar will
get a pointer to foo and can change it as described above.
See also: create-buffer-var, markring.mut
(buffers) [zip : NUMBER]
Return the number of buffers.
See also: nth-buffer.
(case-bag op bag-id) [NUMBER NUMBER : VOID]
Do some case folding on the contents of a bag.
op action
-- ------
0 Lower case text. All text in the bag is converted to lower case
in place.
1 Upper case text.
2 Capitalize text. All text in the bag is captialized. The
starts of words are converted to upper case and all other text
is converted to lower case. A character is the start of a word
if: It is the first character in the bag and the syntax tables
say it is a word character or the character is a word character
and the character before it is a nonword character (white space).
See also: modify-syntax-entry, case.mut (for examples).
(clear-buffer) [zip : VOID]
Clear the current buffer.
Remove all contents of the buffer and clear the marks. There is no
checking - you need to do that if you care. If undo is turned on,
the undo stack is cleared (yeah, I know it stinks, but I had my
reasons).
See also: free-buffer
(clear-bag bag-id) [NUMBER : NUMBER]
Clears the bag by setting it to "". The bag type is set to TEXT.
Bag id 0 is the cut buffer.
Returns bag-id.
See also: append-to-bag, create-bag, insert-bag, bag-stats.
(compare-marks [mark1 mark2]) [[NUMBER NUMBER] : NUMBER]
Returns: 1 (dot on same line as mark), 2 (dot above mark),
3 (dot below mark).
See also: region-stats.
(complete selector "prompt") [NUMBER STRING : STRING]
Works the same as (ask) but allows command completion.
Selector: bitwise OR the lists you want to complete:
bit value list
0 0x01 ME keywords (listed in ME2.DOC)
1 0x02 program names
2 0x04 Mutt keywords
3 0x08 buffer names
4 0x10 system vars
5 0x20 File names
For example: Get a file path, using file name completion and insert
it at the dot:
(defun insert-file-name
{ (insert-text (complete 0x20 "file name: ")) })
See also: ask (in MUTT2.DOC)
(create-bag [immortal]) [[BOOLEAN] : NUMBER]
Create a bag and return its id. Whenever you need to do something
with this new bag, use its id.
The immortal flag controls how a bag is treated at garbage collection
time. If TRUE, the bag won't be garbage collected and you have to
use free-bag to get rid of the bag.
The cut buffer always has an id of 0 and is created by ME at startup.
See also: free-bag, the discussion about garbage collection.
(create-buffer name [flags]) [STRING [NUMBER] : NUMBER]
Create a buffer and return its id. Whenever you need to do something
with this new buffer, use its id.
The name can be anything you want - it can be empty, contain blanks,
be the same as other buffer names, etc. Since the buffer is refered
to by its id, there is no confusion. Where the confusion comes in
is when the user wants to deal with the buffer - in that case, you
might want to use something reasonable for the name.
See buffer-flags for info on those. Remember to set the immortal bit
if you want the buffer to hang around.
(buffer-created-hook) is called.
See also: attached-buffer, buffer-flags, free-buffer, the discussion
about garbage collection, buffer-created-hook.
(create-buffer-var type name [name ...]) [NUMBER STRING ... : VOID]
Create one or more buffer variables with a given type.
Supported types:
NUMBER 0x03
STRING 0x08
LIST 0x09
Buffer local variables are variables that live in a buffer. This
allows you to store localized data in a buffer - two buffers can
have variables of the same name that contain different data (or even
data with different types). This is useful when you need one
variable to hold different data for each buffer (such as with mark
rings - each buffer has a different ring but the mark ring code is
the same for all buffers).
Buffer vars live and die with the buffer. When the buffer is freed,
all the buffer vars are too. This is the only way to remove buffer
vars from a buffer.
If a buffer var named <name> already exists, create-buffer-var doesn't
do anything. It should at least check to see if the types match.
See also: buffer-var, markring.mut
(create-mark [immortal]) [[BOOLEAN] : NUMBER]
Create a mark and return its id. Whenever you need to do something
with this new mark, use its id. Marks are always created in the
current buffer and are invalid (ie not marking anything) when
created.
The immortal flag controls how a mark is treated at garbage collection
time. If TRUE, the mark won't be garbage collected and you have use
free-mark to get rid of the mark.
When a buffer is created, two marks are allocated in it: the dot (id
0) and the mark (id 1). They are always in the buffer can be used
just like any other mark. They can't be freed.
See also: free-mark, the discussion about garbage collection and marks.
(create-process command) [STRING : NUMBER]
Create a process that will run concurrently with ME2. Command is
passed to the compute server for parsing and running. The process
commuicates to your Mutt program via the process-hook hook.
Notes:
The compute server is not built into ME - it is also a separate
process. For this reason (and others), only Unix supports
the compute server. It needs to be running before create-process
is called. The socket name for ME is "$HOME/.ME2.socket".
You can have many processes running. Your Mutt programs will have
to keep track of the process ids to be able to track each process.
Returns:
Process id. -1 if can't create a process. This id will be used by
process-hook when the process sends messages to Mutt programs.
See also: process-hook, documentation on the compute server
(COMSERVER.DOC).
(current-buffer [buffer-id [display-buffer]])
[[NUMBER [BOOLEAN]] : NUMBER]
Return the id of the current buffer.
To change the current buffer, pass in the id. If you want the new
current buffer to be displayed in the current window, pass
display-buffer as TRUE. The current window will be sync'ed with the
buffer (ie the window dot will be in the same place as the buffer
dot).
If you change the current buffer without displaying it, the windows
will be unaffected by anything that happens in the buffer - ie you
would not be able to see anything happening on the screeen. When
the program finishes running, the buffers and windows will be synced
up to what they were before the program ran.
If you change the current buffer and the new current buffer is
displayed in a non-current window, changes you make to the buffer
might not be reflected in that window. See "update" for more on
this.
See also: create-buffer, buffer-modified, buffer-name, buffers,
file-name, update.
(current-column [column]) [[NUMBER] : NUMBER]
With no argument, returns the column after the dot. Otherwise, the
dot is set to column.
(beginning-of-line) is 1.
When you set the current-column, the dot will get as close as possible
to the position you specify, subject to:
- the dot will not leave the current line.
- because of tabs and such, the dot may not be in the column you
specify but will be BEFORE the character that would have caused
the dot to be beyond the specified position.
The new dot column is returned.
If you wish to force the dot to be in column n, use (current-column n)
(to-col n).
(current-directory [directory]) [[STRING] : STRING|BOOLEAN]
(current-directory) returns the current directory (eg "/users/craig").
(current-directory "tools") attempts to set the current directory to
tools. Returns TRUE if successful, FALSE otherwise.
Note: Only Unix versions of ME2 can change the dir. Wildcards and ~
OK.
See also: dir.mut for examples.
(current-window [n]) [[NUMBER] : NUMBER]
Return the id of the current window. The windows are numbered 0,
1, ... (windows)-1 where window 0 is the top window on the screen.
If changing the current window then:
The current buffer is changed to the one being displayed in window
n. For example, if the current buffer is "foo" and window 0 is
displaying buffer "bar", (current-window 0) also changes the
current buffer to "bar".
The window dot is copied into the buffer dot ie the current buffer
is sync'ed with the current window. Thus a buffer will track
window changes BUT NOT vice versa.
See also: attached-buffer, windows, update, (next-window),
(previous-window) (in ME2.DOC).
(do-undo) [zip : NUMBER]
If undo is turned on for this buffer, undo the last block of changes.
Returns:
0 : Nothing happened (despite my best efforts)
1 : Something happened (ie something was undid)
2 : Problems of some unknow nature
See also: buffer-flags, create-buffer, buffer-created-hook.
(EoB) [zip : BOOLEAN]
True if the cursor is at the end of the buffer. Note that end of
buffer is the empty line you get to with (end-of-buffer).
(erase-rectangle delete) [BOOLEAN : VOID]
Delete or clear the region-rectangle. If delete is TRUE, the text in
the rectangle is removed, otherwise it is set to blanks (short lines
are not extended).
The dot is left at the upper left corner of the rectangle and the mark
is at the lower right corner.
The region-rectangle is the rectangle that has the dot at one corner
and the mark at the oppsite corner.
See also: append-to-bag, register-stats.
(exe-key keycode) [NUMBER : BOOLEAN]
Execute a key gotten by get-key. This is the same as pressing that
key combo on the keyboard.
Returns TRUE if the key was executable.
Note: key-pressed is set to the key being executed.
See also: arg-prefix, get-key, key-pressed.
(file-exists file-name) [STRING : BOOLEAN]
Returns TRUE if file-name exists on disk. If (file-exists file-name)
returns TRUE then (visit-file file-name) should also return TRUE.
(file-name buffer-id [new-name]) [NUMBER [STRING] : STRING]
(file-name buffer-id [new-name])
[NUMBER : STRING]
[NUMBER STRING : BOOLEAN]
Return the name of the file attached to the nth buffer. If a file is
NOT attached, returns "".
(file-name -1) returns the name of the file attached to the current
buffer.
With new-name, attach a new name for the file attached to the current
buffer. Returns TRUE is everything went as expected.
See also: buffer-name.
(file-to-bag file-name bag-id) [STRING NUMBER : BOOLEAN]
Copy the contents of a file to a bag. The old contents of the bag are
cleared.
If bag-id is bad, the program aborts.
If some kind of error occurs (can't open file-name or can't copy all
of file-name into bag), FALSE is returned so you can clean up if
necessary.
See also: bag-to-file, bag-to-string
(forward-line n) [NUMBER : BOOLEAN]
Move the dot forward n lines (backwards if n < 0).
The dot is left at column one.
Returns TRUE if all OK, FALSE if try move off the edge of the buffer
(the dot is left at the closest edge).
(free-bag bag-id ...) [[NUMBER [NUMBER ...]] : VOID]
Free zero or more bags and their contents. It is always a good idea
to free bags after you use them (to save space, etc) but you only
really have to if the bag is immortal. Mortal bags will be garbage
collected after your program has finished running.
Note:
While it possible to free the cut-buffer (id 0), it is a bad idea
(and probably a bug). Lots of people assume (yeah, I know what
they say about that) that the cut buffer exists and just use it.
If you do free it, expect fire works.
See also: create-bag.
(free-buffer buffer-id) [NUMBER : NUMBER]
Free a buffer and all its contents, keys and other resources. If not
freed, mortal buffers will be garbaged collected.
See also: create-buffer.
(free-mark mark-id ...) [[NUMBER [NUMBER ...]] : VOID]
Free zero or more marks. It is always a good idea to free marks after
you use them (to save space, etc) but you only really have to if the
mark is immortal. Mortal marks will be garbage collected after your
program has finished running.
You can't free the dot (id 0) or the mark (id 1).
See also: create-mark.
(free-window n) [NUMBER : BOOLEAN]
Remove the nth window from the screen. n == -1 means the current window.
If there is only one window on screen, it is not deleted and FALSE is
returned otherwise TRUE is returned.
See also: (split-window), (delete-other-windows) (in ME2.DOC).
(get-key) [zip : NUMBER]
Wait for and grap the next ME key combo pressed. These have a rather
strange format so it is a good idea to print out the ones you need
with (insert-text (get-key)). If you look at the hex values you
might see a pattern.
key combo get-key value
CR C-M 333 (0x014D)
f1 F-1 2097 (0x0831)
a 97 (0x0061)
A 65 (0x0041)
^A C-A 321 (0x0141)
^XA ^Xa C-XA 1089 (0x0441)
^X^A C-XC-A 1345 (0x0541)
M-A 577 (0x0241)
See also: exe-key, getchar.
(get-matched sub-string) [STRING : STRING]
Return the RE substitution of the last (re-search-xxx) or
(looking-at).
See REGEXP.DOC for syntax of the sub string.
eg if (re-search-forward 'f\w*r') matched "foobar" then (get-matched "&")
returns "foobar".
See also: (looking-at), (re-string), (re-search-forward),
(re-search-reverse).
(getchar) [zip : STRING]
Get a character from the keyboard with no echo. This is different from
get-key in that the string is the ASCII value of the next key hit. You
should only use this for real raw input.
See also: get-key.
(getenv environment-variable-name) [STRING : STRING]
Get the value of a environment variable.
Returns "" if not found.
For example: (getenv "SHELL") might return "D:/MUSH.EXE".
(goto-line n) [NUMBER : BOOLEAN]
Move the dot to the begining of the nth line in the current buffer.
First line of the buffer is 1. If n is negative, got the nth line
from the end of the buffer.
Returns FALSE is try to move off either end of the buffer. In that
case the dot is left at the buffer edge it tried to move accross (at
the start of the line).
Notes:
Line 0 does not really exist so (goto-line 0) returns FALSE. If you
ignore the error, (goto-line 0) is the same as (goto-line 1).
(goto-mark mark-id) [NUMBER : BOOLEAN]
Move the dot to the mark whos id is mark-id.
Returns FALSE if mark-id doesn't exist or the mark is invalid (hasn't
been set or has been cleared).
See also: create-mark, set-mark, swap-marks.
(insert-bag bag-id) [NUMBER : VOID]
Insert the contents of a bag at the dot in the current buffer.
Bag 0 is the cut buffer. (insert-bag 0) is the same as (yank).
If the bag contains a rectangle, the upper left corner of the
rectangle will be at the dot.
See also: create-bag, append-to-bag, clear-bag, bag-stats.
(insert-text stuff) [STRINGs|NUMBERs|BOOLEANS|VOIDs : VOID]
Same as msg but the string is inserted into the current buffer.
eg (insert-text "foo = " foo)
See also: msg (in MUTT2.DOC).
(is-space) [zip : BOOLEAN]
TRUE if character under cursor is a space or tab.
(key-bound-to keystroke-string) [STRING : STRING]
Tell what command a key is bound to.
For example, (key-bound-to "^A") returns "beginning-of-line".
If the key is not bound, key-bound-to returns "".
The typical Emacs function to tell what a key is bound to is:
describe-key ;; what is a key bound to
{
(string key bind)
(key (ask "Key: "))
(if (== "" (bind (key-bound-to key)))(msg key " is not bound.")
(msg key " is bound to " bind))
})
For Mutt programmer types, a handy program is:
deref-key ;; insert name of the function bound to a key
{
(string key bind)
(key (ask "Key: "))
(if (!= "" (bind (key-bound-to key)))(insert-text bind))
})
This allows programming using keys rather than remembering command
names.
See also: complete.
(key-pressed) [zip : NUMBER]
Returns the keycode of the key pressed to invoke the currently
executing program.
Note: exe-key sets this.
See also: exe-key, picture-self-insert in picture.mut for an example.
(key-waiting [number-of-seconds-to-wait]) [[NUMBER] : BOOLEAN]
Returns TRUE if a user pressed key is sitting in the input buffer.
You can also specify the number of seconds to wait for a key to be
pressed. If a key is pressed during the wait, (key-waiting)
immediately returns TRUE. If no key is pressed and the time is up,
FALSE is returned.
Note: (key-waiting) is the same as (key-waiting 0).
Warning: There are limits to how long you can wait. Due to many
factors, you should limit number-of-seconds-to-wait to less than
32401 (9 hours).
See also: getchar, get-key.
(looking-at RE-string(s)) [STRINGs|NUMBERs|BOOLEANS|VOIDs : BOOLEAN]
Test to see if the text following the dot matches a regular
expression. TRUE if it does. The arguments are concatenated
together to form the RE.
See REGEXP.DOC for syntax of the pattern string.
Example:
If the text following the dot is "foobar" then (looking-at 'f\w*r')
returns TRUE.
You can retrieve the matched info with get-matched.
Remember that if you use the "string" form, "\" & "^" MUST be quoted:
"\\", "\^" if you don't want strange results. You can
avoid this problem by using ' instead of ". (See MUTT2.DOC).
See also: get-matched, re-string.
(modify-syntax-entry modify-string) [STRING : STRING]
Modify the syntax table that is used by things that deal with words, etc.
eg (forward-word) or (re-search-forward).
String has the form: <type><characters to modify> where type is "w" if
characters are parts of words, "W" if characters are not parts of words.
eg (modify-syntax-entry "W0123456789") sez numbers are not parts of words
(modify-syntax-entry "w-") sez "-" is part of a word.
Default parts of words are: A-Za-z0123456789$'_
Returns: modify-string.
(move-cursor row column) [NUMBER NUMBER : VOID]
Move the hardware cursor to (row,column).
Row and column are both start at zero.
Move-cursor does not change the dot.
(nth-buffer [n]) [NUMBER : NUMBER]
Return the id the of the nth buffer. Buffers are in a list, sorted
alphabetically, so (nth-buffer 0) is the buffer with the "smallest"
alphabetical name.
(nth-buffer) returns the count of the current buffer ie return n where
(nth-buffer n) is the id of the current-buffer or find n where
(== (nth-buffer n) (current-buffer)) is TRUE.
(OS-filter [STRING [NUMBER [NUMBER [BOOLEAN]]]] : BOOLEAN]
filter-name
[in-bag-id (-1 if no bag)]
[out_bag-id (-1 if no bag)]
[insert-output-at-dot])
Uses the Operating System to filter text. On Unix and MS-DOS, this is
"filter-name <text_in >text_out".
in-bag-id contains the text_in to be run through the filter. If id is
-1, there is no standard in for the filter. Useful if you just want
stuff like the output of ls or grep.
out-bag-id will contain the transformed input text (text_out). If id
is -1, the filter output is ignored (unless insert-output-at-dot is
TRUE). Useful when the filter creates its own files (such as
uudecode or uncompress).
If insert-output-at-dot is TRUE, the output of the filter is also
inserted into the current buffer at the dot.
OS-filter uses up to 2 files to hold the input and output of the
filter.
On UNIX, these are put in /tmp. On other systems, they are put in
the current directory. You can change the directory with a
environment variable.
UNIX : $TMP is used to hold the directory. eg /v0/users/craig
Note that ME adds a trailing "/" to the name.
MS-DOS : TMP is used. If you have a RAM disk configured as drive
D and want the files put in the root:
SET TMP=D:
Note that ME adds a trailing "/" to the name.
(prefix-key n [new-prefix]) [NUMBER [STRING] : STRING]
Get or set the nth prefix key. Returns the prefix keycode in ASCII
form.
n Notes
- -----
0 The META prefix. Default is C-[ (ESCAPE).
1 Default is C-X.
2 open
3 open
META is a prefix so it can be overloaded (mimiced by) another key.
A consequence of this is you cannot prefix a METAed key when a META
key is a prefix. For example, C-XM-P is OK but M-XM-P is not.
If you have a real META key, you can turn off prefix key 0.
Prefix keys 2 and 3 are open - use them for anything you like.
To turn off a prefix key, set it to "S-" or some other impossible
keycode (like "S-0").
(puts "string") [STRINGs|NUMBERs : STRING]
Send a string to the terminal. ME does not see this.
Useful for defining function keys or creating popup windows.
See also: insert-text, msg, popup.mut
(re-search-forward regular-expression-search-pattern) [STRING : BOOLEAN]
Search from the dot forward for text that matches the regular
expression. If a match is found, the dot is left after the last
matched character.
Returns TRUE if a match is found.
See also: re-search-reverse, search-forward, search.mut, REGEXP.DOC.
(re-search-replace search-pattern replace-pattern)
[STRING STRING : BOOLEAN]
Search for (from the dot to the end of the buffer) and replace every
occurance of search-pattern with replace-pattern. re-search-forward
is used to search and get-matched is called at every match to create
the replacement text.
If re-search-replace is successful, the dot is unmoved and the mark is
left after the last replace. If it fails, the mark is at the start
of the search and the dot is left where the failure occured.
Returns TRUE if at least one replace was done, FALSE if search-pattern
was not found.
See also: search-replace, qr.mut, re-search-forward, get-matched,
REGEXP.DOC.
(re-search-reverse regular-expression-search-pattern) [STRING : BOOLEAN]
Search from the dot backwards (towards the start of the buffer) for
text that matches the regular expression. If a match is found, the
dot is left before the first matched character (ie the cursor is on
the first matched character.
The match algorithm is:
- Backup a character.
- Does the RE match the characters after the dot (remember the dot
is between two characters). This is the same as (looking-at
search-pattern).
Yes: done, leave the dot where it is.
No: repeat until a match is found or run into the start of the
buffer.
Returns TRUE if a match is found.
See also: re-search-forward, search-reverse, search.mut, REGEXP.DOC.
(re-string RE-pattern string) [STRING STRING : BOOLEAN]
Test to see if a string matches a regular expression.
Returns TRUE if it does.
You can retrieve the matched info with get-matched.
See REGEXP.DOC for syntax of the pattern string.
See also: get-matched, looking-at.
(region-stats pointer-to-data) [BLOB : VOID]
Get stats on the region. pointer-to-data is a pointer the data area
that the stats are put into:
(byte type) (small-int ulcol width height) (int size) ;; RegionInfo
type: 1 (dot on same line as mark), 2 (dot above mark), 3 (dot
below mark). This is the same info as (compare-dot-and-mark).
ulcol: upper left column of the region-rectangle.
width, height: of the region-rectangle.
size: Number of bytes in the region.
For example:
get-region-stats
{
(byte type)(small-int ulcol width height)(int size) ;; RegionInfo
(region-stats (loc type))
(msg
(switch type
1 "Dot and mark on same line."
2 "Dot above mark."
3 "Dot below mark."
)
" Upper left column:" ulcol
" Width:" width " Height:" height " Size:" size
)
})
See also: compare-marks.
(search-forward search-pattern) [STRING : BOOLEAN]
Search from the dot forward for text that matches search-pattern. If
a match is found, the dot is left after the last matched character.
Returns TRUE if a match is found.
See also: search-reverse, re-search-forward, search.mut.
(search-replace search-pattern replace-pattern)
[STRING STRING : BOOLEAN]
Search for (from the dot to the end of the buffer) and replace every
occurance of search-pattern with replace-pattern. search-forward is
used to search for a match. Matched text is replaced verbatium with
replace-pattern.
If search-replace is successful, the dot is unmoved and the mark is
left after the last replace. If it fails, the mark is at the start
of the search and the dot is left where the failure occured.
Returns TRUE if at least one replace was done, FALSE if search-pattern
was not found.
See also: re-search-replace, qr.mut, search-forward.
(search-reverse search-pattern) [STRING : BOOLEAN]
Search from the dot backwards (towards the start of the buffer) for
search-pattern. If a match is found, the dot is left before the
first matched character (ie the cursor is on the first matched
character.
The match algorithm is:
- Backup a character.
- Does search-pattern match the characters after the dot (remember
the dot is between two characters).
Yes: done, leave the dot where it is.
No: repeat until a match is found or run into the start of the
buffer.
Returns TRUE if a match is found.
See also: re-search-forward, search-forward, search.mut, REGEXP.DOC.
(set-mark [mark-id]) [[NUMBER] : !!!???]
Set a mark to match the dot. The default is mark 1 (the mark).
See also: create-mark, goto-mark, swap-marks, markring.mut.
(swap-marks [mark1-id mark2-id]) [[NUMBER NUMBER] : NUMBER]
Exchange the locations that two marks point to. If you (swap-marks 0
1) (the default case, same as (swap-marks)), the dot will move to
where the mark was and vice versa. Doing it again will return the
marks to their original values ie (swap-mark a b)(swap-mark a b) is
a no op. If you are moving the dot, the other mark must be valid
(ie have been set). Remember that clear-buffer resets all marks
(except the dot). If you do this, your program will die but ME will
be OK.
See also: goto-mark
(sysvar sysvar-name [value]) [STRING [NUMBER] : NUMBER]
Access or set a sysvar. This enables a program to give the user
access to sysvars.
Example:
(string sysvar-name 50)(sysvar-name "HELP")
(sysvar sysvar-name) gets the current value of HELP and
(sysvar sysvar-name 0) sets it to zero.
See also: sysvar.mut for coding examples.
(to-col column) [NUMBER : NUMBER]
Insert space until the dot is at column. If the dot is at or past
column, nothing happens.
Returns column.
If the sysvar tab-stops is zero then tabs and blanks are used,
otherwise only blanks are used as space.
(update [update-the-screen]) [[BOOLEAN] : VOID]
If update-the-screen is TRUE or not passed in, hard refresh the
screen. Does not affect the minibuffer. Different from
(refresh-screen) in that the refresh occurs now, rather than waiting
for the program to end.
If update-the-screen is FALSE, just sync the buffer and window.
Forces the current window dot to match the current buffer dot IF the
current window is displaying the current buffer.
Notes:
Keys in the typeahead buffer will keep the refresh from completing
(ME2 will finish up later when it has more time).
Refreshing the screen usually takes a long time (from the computers
point of view anyway).
It is important to realize that windows and buffers are independent.
Changing a buffer does not mean that a window displaying the
buffer always reflects those changes. This is usually only a
problem when a program wants a window displaying a buffer to track
the changes the program is making to that buffer. Here are the
rules for programs:
- Windows and buffers have their own dots. Changes to a buffer
dot does not change the window dot.
- If you make changes to a buffer and then want to make changes
to the window displaying that buffer, you usually want to do a
(update FALSE) after the buffer changes and before the window
changes. If you don't do this, the window dot will be in a
different place than the buffer dot and the window probably
won't be showing what you expected. Make sure the current
window is displaying the buffer you are changing.
See also: current-buffer, current-window.
(window-height n [new-height]) [NUMBER [NUMBER]: NUMBER]
Return the height of the nth window (n == -1 means current window).
Note that the height does not include the mode line. If there is only
one window then
(window-height -1) == (window-height 0) == (- (screen-length) 1).
If new-height, then resize the window to the new size (if there is
more than one window).
(window-ledge n [left-edge]) [NUMBER [NUMBER] : NUMBER]
Set the left edge of window n. Returns the current or new value. If
n == -1, the current window is used. The window will display only
the text starting at column left-edge.
If horizontal-scroll is enabled and setting window-ledge causes the
cursor to move off screen, the display routines will reset the left
edge so that the cursor is on screen. Turning off horizontal-scroll
will prevent this.
With this command you can scroll windows manually (ie without using
the cursor) (see wscroll.mut).
The current screen column can be calculated by:
(- (current-column)(window-ledge -1))
See also: horizontal-scroll.
(window-row) [zip : NUMBER]
Return the row the dot is on in the current window. The top row of a
window is 1. Note that this is not the screen row (unless the
current window is the top most one).
Note: It is the display routines that figure out the window-row. If
called when the display is out of sync (such as a program doing
display manipulation) this could very well be incorrect. update can
force a display sync.
(windows) [zip : NUMBER]
Return the number of windows on the screen.
See also: current-window.
(yesno prompt) [STRINGs|NUMBERs|BOOLEANs|VOIDs : BOOLEAN]
Show the prompt (with " [y/n]? " appended) and wait for [Y, y, N, or n]
CR to be typed. Returns TRUE on Y or y. The program aborts on ^G.
Simular to (ask).
Notes:
If not interactive (ie the user is not asked), only "y" or "Y" will
return TRUE.
Use (ask-user) to force user prompting.
See (ask) for potential problems.
========================================================================
== SYSTEM VARIABLES (sysvars) ==
========================================================================
System vars are used like any other var - (sysvar) returns its value and
(sysvar value) sets it to value.
Most sysvars are global - they effect all buffers, windows, etc. Some
sysvars are buffer local - they only effect a single buffer. When you
set a local sysvar, it is set for the current buffer. If you want to set
these to something other than the default for every buffer, do so in
buffer-created-hook.
Unless otherwise noted, all sysvars are global.
(HELP [help-level]) Set the help level [[NUMBER] : NUMBER]
(HELP) returns the current setting.
(HELP n) sets the level to n and returns n.
Help level:
0 : no help
1 : gimme help (if you make typo in (ME-command)
(describe-bindings) will be executed).
Initial value: 1
(beeper [volume]) [[NUMBER] : NUMBER]
Now and then ME will beep at you. This annoys some people. You can tell
ME to shut up by setting beeper to 0. Setting it to nonzero restores
the gift of gab.
Initial value: 1
(case-fold-search [ignore-case]) [[NUMBER] : NUMBER]
Affects searching (query-replace, search-forward, search-reverse).
If 1, case is ignored.
Initial value: 1
(complete-key [keycode]) [[NUMBER] : NUMBER]
This is the keycode that controls command completion.
It is initialized to space (32).
(complete-key) returns the current value.
To change it, use the keycode. See get-key.
For example:
To set the complete key to tab (C-I), use (complete-key 0x149) or
(complete-key 329).
For space, use (complete-key 32).
For control A (C-A), use (complete-key 321).
(horizontal-scroll [step-size]) [[NUMBER] : NUMBER]
This sysvar controls horizontal scrolling - moving text left and right
on the screen. If 0, horizontal scrolling is disabled, otherwise
the horizontal scrolling rate is set to step-size. When the screen
has to scroll, it will move in chunks in order to reduce the amount
screen thrashing. Change it to best suit your hardware and
preferences.
The range for step-size is [0 : screen-width). If you set it outside
of this range, you are asking for many unpleasent surprises.
See also: window-ledge.
(modeline-color [color]) [[NUMBER] : NUMBER]
Change the the mode line color.
Note that the color values are display dependent.
See also: text-color, ERRATA.DOC.
(overstrike [value]) [[NUMBER] : NUMBER]
Overstrike is the mode opposite of insert (the default mode). Overstrike
mode is very much a bag on the side of ME and ment only for occasional
use.
The following are different in overstrike mode:
- The tab key is disabled but you can still set the tab stops.
- <CR> sends you the start of the next line.
- Backspace is the same as backward-character.
- The mode line.
- self-insert don't, they overstrike.
If you wish to have overstrike toggled by the insert key, put the
following into your me2.mut:
(defun toggle-overstrike { (overstrike (- 1 (overstrike))) })
(bind-to-key "toggle-overstrike" "F-G")
Initial value: 0
(screen-length [new-screen-length]) [[NUMBER] : NUMBER]
Change the size of the physical screen. This allows the same ME code
to run on different size screens.
For example, say ME came configured for a HP150 (which has 24 screen
lines) and you wanted to run it on a HP110 (which has 16 lines). To
change the screen size: (screen-length 16).
If you need to use this often, put it in you me2.mut file.
Range: [3 : 400]. If you change this to be longer that the screen
really is, it is hard to edit.
See also: ERRATA.DOC file.
(screen-width [new-screen-width]) [[NUMBER] : NUMBER]
Change the physical screen width.
Range: [15 : 500]
(tab-stops [tab-size]) Local [[NUMBER] : NUMBER]
If given an argument then set the tab stops to every nth column. This
is a buffer local variable.
If n == 0 use the tab character.
If n > 1 use spaces to simulate the tab character.
Initial value: 0
(text-color [color]) [[NUMBER] : NUMBER]
Change the the text color.
Note that the color values are display dependent.
See also: modeline-color, ERRATA.DOC.
(word-wrap [wrap-column]) Local [[NUMBER] : NUMBER]
Setting word-wrap > 0 turns it on, 0 turns it off.
Initial value: 0
When ME decides it is time to word wrap, it does a (exe-key "^M")
which executes whatever is bound to the Enter key. This also
provides a hook if your program wants to do something at that time.
This is a buffer local variable.
========================================================================
== Hooks ==
========================================================================
Hooks are Mutt programs that are called by ME when it thinks somebody
else might be interested in what its about to do. They allow the Mutt
programmer to modify ME's behaivor. If a hook is not defined, it is not
called (ie ME doesn't really care if you don't want to tell it what to
do).
Note: There may be more than one routine that is sharing the hook
call. See the hook support in hook.mut (documented in PACKAGE.DOC). If
you want your code to be a "good citizen" and interact "nicely" with
other Mutt code (that uses hooks), it is important that you use
(register-hook). me2.h has the constants used by register-hook.
For examples of how hooks are used, see hook.mut and alamode.mut.
(buffer-created-hook) [zip : zip]
This is called when a buffer is created and allows a Mutt program to
set up a buffer.
Notes:
If you switch buffers, you should switch back so that other routines
sharing this hook will have the correct current buffer when they
are called.
Register with
(register-hook BUFFER-CREATED-HOOK name-of-your-routine).
BUGS:
Does not get called for "*scratch*" (the default buffer created when
ME starts up) because me2.mco has not been loaded yet.
If you want it called for *scratch* then put (buffer-created-hook)
into the load time code of me2.mut. Note that if you delete
*scratch* in the MAIN of me2.mut then you will not need to do this
because *scratch* will be recreated if no other buffers exist.
Also, if you read in a files, buffer-created-hook will be called.
See also: create-buffer, ibuffer-created-hook.
(enter-ME-hook) [zip : zip]
When ME starts up and opens the display, it calls this hook. For
example, (shell-command) calls this after the shell command is run
and returns control to ME.
Note:
This is not called when ME is first run because it would be called
before any Mutt programs were loaded. If you need that
functionality, do it with MAIN routines.
Register with (register-hook ENTER-ME-HOOK name-of-your-routine).
See also: leave-ME-hook.
ibuffer-created-hook [zip : zip]
This is called when a interactive buffer is created and allows a Mutt
program to set up a buffer. Interactive buffers are those buffers
ment for human interaction. Since most Mutt buffer-created code
only cares about interactive buffers (why set a buffer mode if
nobody will ever use it?) and lots of non-interactive buffers are
created, using this hook will reduce work ME has to do (and a few
other things that I'm having a hard time explaining).
This is not a real hook! It is never called. You can only get access
to this functionality if you use register-hook.
Notes:
If you switch buffers, you should switch back so that other routines
sharing this hook will have the correct current buffer when they
are called.
Register with
(register-hook IBUFFER-CREATED-HOOK name-of-your-routine).
See also: buffer-flags, buffer-created-hook, iread-buffer-hook.
iread-file-hook [zip : zip]
This hook is called after a file has been read into the current
buffer and the current buffer is interactive.
The dot is at the beginning of the buffer.
This is not a real hook! It is never called. You can only get access
to this functionality if you use register-hook.
Notes:
Register with (register-hook IREAD-FILE-HOOK name-of-your-routine).
See also: read-file-hook and ibuffer-created-hook.
(key-pressed-hook key) [NUMBER : zip]
This is called when the user presses a key in the main loop (ie
key-pressed-hook is not called from the following: get-key,
exe-key, anything that queries the user in the mini buffer). The
key is passed to the hook. See get-key for the format of a key.
After the hook has finished, the key is executed.
Notes:
This hook is not supported by register-hook. It really slows things
down to do so and is not used much.
For example:
If the user presses "a", (key-pressed-hook 0x61) is called and then
"a" is inserted.
Pressing ^X^F causes (key-pressed-hook 0x546) to be called. After
the hook returns, visit-file is called. Any keys pressed while in
visit-file will NOT trigger the hook.
See also: key-pressed, saveall.mut and abbrev.mut for examples.
(leave-ME-hook) [zip : zip]
Called when the display is being closed in preparation for leaving ME.
This is when you quit ME or do something with a shell.
Notes:
Register with (register-hook LEAVE-ME-HOOK name-of-your-routine).
See also: enter-ME-hook.
(modeline-hook) [zip : STRING]
This hook is called when a window needs a new modeline. Whatever the
hook returns is put into the modeline. The last character of the
return value is repeated to the end of the modeline.
For exmaple:
(defun modeline-hook
{ (concat "ME is editing " (buffer-name -1) " -") })
If the current buffer is foo, then the modeline line will look like:
"ME is editing foo --------------------------------------"
Notes:
The modelines for windows are not updated until ME thinks that the
modeline needs to be updated. A good way to do this for a buffer
is: (buffer-flags -1 Mode).
The last character is repeated because it makes life easier on the
hook (it doesn't have to know about the physical display).
Not supported by register-hook. It doesn't make sense to chain this
hook. If you need to have your own modeline for a buffer, do it
with a buffer variable (see modeline.mut). If you don't like the
modeline format, change modeline.mut.
See also: modeline.mut for examples.
(process-hook pid OUTPUT-STDOUT text) [NUMBER 1 STRING : ]
(process-hook pid OUTPUT-STDERR text) [NUMBER 2 STRING : ]
(process-hook pid PROCESS-DONE exit-status) [NUMBER 0 NUMBER : ]
(process-hook pid ERROR error-code) [NUMBER 3 NUMBER : ]
where PROCESS-DONE == 0, OUTPUT-STDOUT == 1, OUTPUT-STDERR == 2,
ERROR == 3.
This hook is used by external processes (created by create-process)
talk to Mutt programs.
Since multiple processes can be running, you need to use the hook
management facilities in hook.mut so that other Mutt programs can
manage their own processes.
Remember the id of the process you create so that you can tell if the
hook is for you.
ERROR codes are:
CS_ERROR_SERVER_DIED 0
For some reason, the compute server is going to stop running very
soon.
CS_ERROR_PROTOCOL 1
ME sent garbage to the compute server.
CS_ERROR_READ 2
ME read garbage from the compute server.
All these errors result in all processes terminating, not just
yours. You will have to start over and recreate them. If you see
an ERROR event, ignore the pid and treat handle the error
because this is the last event your pid will get (until it is
recreated).
Notes:
Register with (register-hook PROCESS-HOOK name-of-your-routine).
See also: create-process, hook.mut, compile.mut, COMSERVER.DOC.
(read-file-hook) [zip : zip]
This hook is called after a file has been read into the current
buffer.
The dot is at the beginning of the buffer.
Notes:
Register with (register-hook READ-FILE-HOOK name-of-your-routine).
See also: visit-file and read-file (in ME2.DOC).
========================================================================
== Miscellaneous ==
========================================================================
Initialization file (me2.mco)
ME has an initialization file "me2.mco". See (load) in ME2.DOC
for where this is loaded from.
Note that if there is an initialization file and it loads OK, ME
does not process the command line in any way. This means that
me2.mut can process argv in anyway it wants to. It also means it has
to read in any files the user stuck there for editing. You can create
your own command line options, read all the files in at once, read the
files one at a time, etc.